package com.minsf.rpc.loadbalancer;

import com.minsf.rpc.spi.SpiLoader;

/**
 * @Description
 * @Author minify
 * @Date 2024/3/31 19:46
 * @Project sf-rpc
 */
public class LoadBalancerFactory {

    static  {
        SpiLoader.load(LoadBalancer.class);
    }

    /**
     * 默认负载均衡器
     */
    private static final LoadBalancer DEFAULT_LOAD_BALANCER = new RoundRobinLoadBalancer();

    /**
     * 获取实例
     * @param key
     * @return
     */
    public static LoadBalancer getInstance(String key) {
        return SpiLoader.getInstance(LoadBalancer.class, key);
    }
}
